//leetcode 506.相对名次//
class Solution {
public:
    vector<string> findRelativeRanks(vector<int>& score) {
        int n = score.size();
        vector<pair<int, int>> sIndex;

        for (int i = 0; i < n; i++)
        {
            sIndex.push_back({ score[i], i });
        }
        sort(sIndex.rbegin(), sIndex.rend());
        vector<string> result(n);
        vector<string> medals = { "Gold Medal","Silver Medal","Bronze Medal" };

        for (int i = 0; i < n; i++)
        {
            int index = sIndex[i].second;
            if (i < 3)
            {
                result[index] = medals[i];
            }
            else
            {
                result[index] = to_string(i + 1);
            }
        }
        return result;
    }
};
